function [cor,se] = corr_hac(y,x)

% corr is the correlation of x,y
% se is the standard error for the correlation using hac standard errors
% x needs to be one vector

n = size(y,2);
se = zeros(n,1);
cor = zeros(n,1);
for i = 1:n
    [~,se_temp] = hac(x,y(:,i),'Display','off');
    se(i) = se_temp(2)*std(x)/std(y(:,i));
    cor(i) = corr(y(:,i),x);
end

end

